import os
import time
from multiprocessing import Process
import setproctitle

def worker():
    print("子进程执行中>>> pid={0}, ppid={1}".format(os.getpid(), os.getppid()))
    setproctitle.setproctitle("subxxxxxx")
    time.sleep(2)
    os._exit(2)
    time.sleep(23)


def main():
    ps = []
    # 创建子进程实例
    p = Process(target=worker, name="worker xxxx", args=())
    setproctitle.setproctitle("mainxxxxx")
    p.start()
    p.join()
    print("主进程终止")
    time.sleep(100)
    print("over")


if __name__ == '__main__':
    main()
